package team.yidong.fenda.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import team.yidong.fenda.entity.HospitalSchedule;

import java.util.List;

/**
 * Created by xuanlong on 2018/3/30.
 */
@Repository
public interface HospitalScheduleRepository extends JpaRepository<HospitalSchedule, Integer>, JpaSpecificationExecutor<HospitalSchedule> {
    @Query("select schedule from HospitalSchedule schedule where schedule.hospitalId=?1 and  schedule.peopleNum=?2")
    HospitalSchedule findSchedule(Integer hospitalId, Integer peopleNum);

    List<HospitalSchedule> findByHospitalId(Integer hospitalId);

    HospitalSchedule findByPeopleNumAndDayTime(Integer peopleNum, String datTime);

}
